<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue.js"></script>
  <style>
    .outer {
      width: 300px;
      height: 300px;
      background-color: skyblue;
      overflow: scroll;
    }
    .inner {
      width: 100px;
      height: 500px;
      margin: 100px;
      background: slateblue;
    }
  </style>
</head>
<body>
  <div id="app">
    <a @click.prevent="clickHandler" href="https://www.baidu.com">百度一下</a>
    <button @click.once="clickHandler">按钮1</button>
    <!-- 按键修饰符 -->
    <input type="text" @keyup.enter="keyUpHandler">
    <!-- 鼠标修饰符 -->
    <input type="text" @mouseup.right="keyUpHandler">
    <div class="outer" @scroll.passive="scrollHandler" @click.capture="outerHandler">
      outer
      <div class="inner" @click.capture="innerHandler">
        inner
      </div>
    </div>
  </div>
  <script>
    new Vue({
      el: '#app',
      data: {

      },
      methods: {
        // 键盘抬起事件
        keyUpHandler() {
          console.log('键盘抬起');
        },
        // 滚动事件处理函数
        scrollHandler() {
          for(let i = 0;i<1000;i++) {
            console.log(i);
          }
        },
        // 1.按钮点击事件处理函数
        clickHandler(e) {
          // e.preventDefault();
          alert('点击事件')
        },
        innerHandler(e) {
          console.log('inner',e.target,e.currentTarget);
        },
        outerHandler(e) {
          console.log('outer',e.target,e.currentTarget);
        }
      }
    })
  </script>
</body>
</html>